<!-- 为项目添加工程 -->
<script type="text/ng-template" id="addPlanProject.html">
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header" style="margin-top:1px;">
                        <h3>添加工程</h3>
                    </div>
                    <div class="box-body">
                        <input type="radio" value="0" name="projectType" ng-click="proTypeChange();"
                               ng-model="info.projectType"/>&nbsp;&nbsp;新建工程
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="radio" value="1" name="projectType" ng-click="proTypeChange();"
                               ng-model="info.projectType"/>&nbsp;&nbsp;已有工程
                        <br>
                        <br>
                        <uib-accordion close-others="false">
                            <uib-accordion-group is-open="true" ng-if="info.projectType == '0'">
                                <table width="95%">
                                    <tbody>
                                    <tr style="line-height: 60px;">
                                        <td> 工程:</td>
                                        <td>
                                            <select ng-model="info.trunkName"
                                                    ng-change="getPlanProjectDefaultName()">
                                                <option value="">请选择工程</option>
                                                <div ng-repeat="i in info.projectList">
                                                    <option ng-show="i.project_name!=s.project_name"
                                                            value="{{s.project_name}}"
                                                            ng-repeat="s in info.showTrunkList">
                                                        {{s.project_name}}
                                                    </option>
                                                </div>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr style="line-height: 60px;">
                                        <td> 来源:</td>
                                        <td>
                                            <select style="width: 205px;" ng-model="info.svn_form">
                                                <option value="">请选择来源</option>
                                                <option value="{{i.name}}" ng-repeat="i in info.projectInfo.svn_list">
                                                    {{i.name}}
                                                </option>
                                            </select>

                                        </td>
                                    </tr>
                                    <tr style="line-height: 60px;">
                                        <td> 分支版本:</td>
                                        <td>
                                            <input style="width: 205px;line-height: 20px;" type="text"
                                                   ng-model="info.projectInfo.branch_num"
                                                   ng-change="updateBranch_num()">

                                        </td>

                                    </tr>
                                    <tr ng-show="info.msg!=''">
                                        <td></td>
                                        <td><span style="color: red">{{info.msg}}</span></td>
                                    </tr>
                                    <tr style="line-height: 60px;">
                                        <td> 目标工程:</td>
                                        <td ng-hide="info.projectInfo.length ==''">
                                            {{info.projectInfo.trunk_name}}-{{info.projectInfo.branch_num}}.{{info.planInfo.plan_code}}
                                        </td>
                                        <td ng-show="info.projectInfo.length ==''">
                                            0.0
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </uib-accordion-group>
                            <uib-accordion-group is-open="true" ng-if="info.projectType == '1'">
                                <span style="color: red;">不能选择主干工程进行添加,如果要使用主干,需要选择"新建工程",然后从主干上创建一个新分支</span>
                                <br>
                                <br>
                                <table width="100%;">
                                    <tr style="line-height: 40px;">
                                        <td style="width: 5%;">主干:</td>
                                        <td style="width: 20%;">
                                            <input type="text" ng-model="info.trunkInfo" placeholder="选择主干工程"
                                                   uib-typeahead="project as project.projectName for project in info.trunkList | filter:{projectName:$viewValue}|limitTo:15"
                                                   typeahead-template-url="selectTemplate.html" class="form-control"
                                                   typeahead-show-hint="true" typeahead-min-length="0"
                                                   typeahead-on-select="getBeetleProjectListByTrunk();"
                                                   typeahead-select-on-blur="true">
                                        </td>
                                        <td style="width: 5%;text-align: center;">分支:</td>
                                        <td style="width: 20%;">
                                            <input type="text" ng-model="info.projectInfo" placeholder="选择分支工程"
                                                   uib-typeahead="project as project.projectName for project in info.projectList | filter:{projectName:$viewValue}|limitTo:15"
                                                   typeahead-template-url="selectTemplate.html" class="form-control"
                                                   typeahead-show-hint="true" typeahead-min-length="0"
                                                   typeahead-select-on-blur="true">
                                        </td>
                                    </tr>
                                </table>
                            </uib-accordion-group>
                        </uib-accordion>
                        <div class="modal-footer">
                            <button class="btn btn-warning" type="button" ng-click="save()"
                                    ng-disabled="(info.projectType == '0' && info.msg!='')
                                    || (info.projectType == '1'&&(info.projectInfo.projectName == info.trunkInfo.projectName ||info.projectInfo.projectName == undefined||info.trunkInfo.projectName == undefined))">
                                Save
                            </button>
                            <button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</script>